-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Draft] Proposal for fixing build.zig to work with unmodified cimgui. #27
Conversation
Ooof, |
What's zig version in your host? |
...I added what I thought would be a missing build dependency, but the build is still broken because later on there are quite a few places that call
...no idea how to fix this one... maybe the best approach is actually to update your cimgui fork :/ |
...currently PS: 0.13.0 doesn't make a difference. |
In my host (linux): $ dub build :imgui
Starting Performing "debug" build using ldc2 for x86_64.
Building sokol-d:imgui 0.1.3: building configuration [application]
Pre-build Running commands
Linking sokol-d_imgui
$ zig build --summary all
./src/examples/cube.d(38,14): `state` is thread local
./src/examples/clear.d(16,15): `pass_action` is thread local
./src/examples/sgl_points.d(35,14): `state` is thread local
./src/examples/sgl_context.d(44,14): `state` is thread local
./src/examples/debugtext.d(37,14): `state` is thread local
./src/examples/mrt.d(68,14): `state` is thread local
./src/examples/triangle.d(21,14): `state` is thread local
./src/examples/blend.d(33,14): `state` is thread local
./src/examples/saudio.d(28,14): `state` is thread local
./src/examples/user_data.d(32,22): vgc: assigning an associative array element may cause a GC allocation
Build Summary: 12/12 steps succeeded
install success
├─ clear success 815ms MaxRSS:231M
│ └─ zig build-lib sokol Debug native success 3s MaxRSS:262M
├─ triangle success 174ms MaxRSS:93M
│ └─ zig build-lib sokol Debug native (reused)
├─ cube success 241ms MaxRSS:109M
│ └─ zig build-lib sokol Debug native (reused)
├─ blend success 217ms MaxRSS:112M
│ └─ zig build-lib sokol Debug native (reused)
├─ mrt success 240ms MaxRSS:114M
│ └─ zig build-lib sokol Debug native (reused)
├─ saudio success 177ms MaxRSS:92M
│ └─ zig build-lib sokol Debug native (reused)
├─ sgl_context success 230ms MaxRSS:112M
│ └─ zig build-lib sokol Debug native (reused)
├─ sgl_points success 226ms MaxRSS:110M
│ └─ zig build-lib sokol Debug native (reused)
├─ debugtext success 187ms MaxRSS:95M
│ └─ zig build-lib sokol Debug native (reused)
└─ user_data success 648ms MaxRSS:220M
└─ zig build-lib sokol Debug native (reused) |
Yeah, just |
Try |
But (rebuild, no clean): $ zig build --summary all -Dimgui
getPath() was called on a GeneratedFile that wasn't built yet.
source package path: /home/kassane/sokol-d
Is there a missing Step dependency on step 'WriteFile '?
The step was created by this stack trace:
name: 'WriteFile '. creation stack trace:
/home/kassane/zig-bootstrap/out/zig-mos-x86_64-linux-musl-baseline/lib/std/Build/Step/WriteFile.zig:70:26: 0x1472f2a in create (build)
.step = Step.init(.{
^
/home/kassane/zig-bootstrap/out/zig-mos-x86_64-linux-musl-baseline/lib/std/Build.zig:1058:37: 0x141a674 in addNamedWriteFiles (build)
const wf = Step.WriteFile.create(b);
^
/home/kassane/sokol-d/build.zig:854:36: 0x1419beb in buildImgui (build)
const wf = b.addNamedWriteFiles("cimgui");
^
/home/kassane/sokol-d/build.zig:191:38: 0x141c40f in buildLibSokol (build)
const cimgui = try buildImgui(b, .{
^
/home/kassane/sokol-d/build.zig:222:40: 0x1425c54 in build (build)
const lib_sokol = try buildLibSokol(b, .{
^
/home/kassane/zig-bootstrap/out/zig-mos-x86_64-linux-musl-baseline/lib/std/Build.zig:2155:44: 0x13feac4 in runBuild__anon_4851 (build)
.error_union => try build_zig.build(b),
^
/home/kassane/zig-bootstrap/out/zig-mos-x86_64-linux-musl-baseline/lib/compiler/build_runner.zig:335:29: 0x13f99f9 in main (build)
try builder.runBuild(root);
^
/home/kassane/zig-bootstrap/out/zig-mos-x86_64-linux-musl-baseline/lib/std/start.zig:617:37: 0x13d5142 in posixCallMainAndExit (build)
const result = root.main() catch |err| {
^
Hope that helps. Proceeding to panic.
thread 21985 panic: misconfigured build script
/home/kassane/zig-bootstrap/out/zig-mos-x86_64-linux-musl-baseline/lib/std/Build.zig:2383:25: 0x14c2884 in getPath3 (build)
@panic("misconfigured build script");
^
/home/kassane/zig-bootstrap/out/zig-mos-x86_64-linux-musl-baseline/lib/std/Build.zig:2354:27: 0x14704ab in getPath2 (build)
const p = getPath3(lazy_path, src_builder, asking_step);
^
/home/kassane/zig-bootstrap/out/zig-mos-x86_64-linux-musl-baseline/lib/std/Build.zig:2349:24: 0x1419864 in getPath (build)
return getPath2(lazy_path, src_builder, null);
^
/home/kassane/sokol-d/build.zig:434:41: 0x1420b7d in ldcBuildStep (build)
include_dir.path.getPath(b)
^
/home/kassane/sokol-d/build.zig:255:41: 0x14262aa in build (build)
const ldc = try ldcBuildStep(b, .{
^
/home/kassane/zig-bootstrap/out/zig-mos-x86_64-linux-musl-baseline/lib/std/Build.zig:2155:44: 0x13feac4 in runBuild__anon_4851 (build)
.error_union => try build_zig.build(b),
^
/home/kassane/zig-bootstrap/out/zig-mos-x86_64-linux-musl-baseline/lib/compiler/build_runner.zig:335:29: 0x13f99f9 in main (build)
try builder.runBuild(root);
^
/home/kassane/zig-bootstrap/out/zig-mos-x86_64-linux-musl-baseline/lib/std/start.zig:617:37: 0x13d5142 in posixCallMainAndExit (build)
const result = root.main() catch |err| {
^
/home/kassane/zig-bootstrap/out/zig-mos-x86_64-linux-musl-baseline/lib/std/start.zig:250:5: 0x13d4d1f in _start (build)
asm volatile (switch (native_arch) {
^
???:?:?: 0x0 in ??? (???)
error: the following build command crashed:
/home/kassane/sokol-d/.zig-cache/o/c5449b067db55ce2b1e03be76a44c8a1/build /home/kassane/zig-bootstrap/out/zig-mos-x86_64-linux-musl-baseline/zig /home/kassane/zig-bootstrap/out/zig-mos-x86_64-linux-musl-baseline/lib /home/kassane/sokol-d /home/kassane/sokol-d/.zig-cache /home/kassane/.cache/zig --seed 0x60388260 -Z11dd7ae8b3482200 --summary all -Dimgui |
In any case, maybe it's best to go back to the original idea of updating your cimgui fork to 1.91.1, and then change build.zig.zon to your fork again... |
Ok! I do. For this PR, maybe need refactor, ldc2-build! |
@floooh , see my refactor: https://github.com/kassane/anotherBuildStep/blob/main/toolchains/ldmd2.zig TODO: My idea in the roadmap is to separate the buldstep process into a separate project instead of cramming everything into the same script. However, I had problems with the change to zig-build in v0.14.0-dev in relation to cc-wrapper. |
cimgui-forked update: 23c134c |
Since the CI is green now again with your cimgui fork update I'll just close this PR. |
Inspired by
https://github.com/floooh/sokol-zig-imgui-sample/blob/2597832beb515cf282189422d6fa4e84c8daa0b9/deps/cimgui/build.zig#L11-L15
...
this makes. The resulting executable still doesn't run because it wants to load sokol as DLL, but I think/guess/hope that's unrelated:dub build :imgui
build without errors on my Maccloses: #26